<?PHP
#
# author: Cody Sorgenfrey
# (c)2012 South Hill Calvary Chapel
#

include_once("../mysql/database_info.php");
include_once("common.php");
include_once("../mysql/common.php");

$day = $_GET['day'];
if (!(isset($_GET['day']) && ($day == 'Sun' || $day == 'Wed' || $day =='Sat'))) {
    die ("Error:  Bad input '$day' must be Sat, Sun, or Wed");
}

if ($day == Sun) {
	$title = "Archived Sunday Parent Connections";
	$meta_key='Sunday, archived, parent, family, mom, dad, gaurdian, connecting, connection, newsletter, children, kids, bible, craft, game, worship, sunday, school, jesus';
	$meta_desc="The Parent Connections are to used by parents to stay connected with CM at South Hill Calvary Chapel.";
	startPage($title, $meta_key, $meta_desc, $morehtml, $morejava);

  $table = "cm-pc";
  connect_select_test($table);
  $query="SELECT * FROM `$table` WHERE day='Sunday' ORDER BY date DESC";
  $result=mysql_query($query) or die (mysql_error());
  $num_rows=mysql_num_rows($result);
  Mcm_pc_table($result,$num_rows, false, 'Sunday');
} else if ($day == Sat) {
	$title = "Archived Saturday Parent Connections";
	$meta_key='Saturday, archived, parent, family, mom, dad, gaurdian, connecting, connection, newsletter, children, kids, bible, craft, game, worship, sunday, school, jesus';
	$meta_desc="The Parent Connections are to used by parents to stay connected with CM at South Hill Calvary Chapel.";
	startPage($title, $meta_key, $meta_desc, $morehtml, $morejava);

  $table = "cm-pc";
  connect_select_test($table);
  $query="SELECT * FROM `$table` WHERE day='Saturday' ORDER BY date DESC";
  $result=mysql_query($query) or die (mysql_error());
  $num_rows=mysql_num_rows($result);
  Mcm_pc_table($result,$num_rows, false, 'Saturday');
} else {
	$title = "Archived Wednesday Thru the Bible Parent Connections";
	$meta_key='Wednesday, archived, parent, family, mom, dad, gaurdian, connecting, connection, newsletter, children, kids, bible, craft, game, worship, sunday, school, jesus';
	$meta_desc="The Parent Connections are to used by parents to stay connected with CM at South Hill Calvary Chapel.";
	startPage($title, $meta_key, $meta_desc, $morehtml, $morejava);

  $table = "cm-pc";
  connect_select_test($table);
  $query="SELECT * FROM `$table` WHERE day ='Wednesday' ORDER BY date DESC";
  $result=mysql_query($query) or die (mysql_error());
  $num_rows=mysql_num_rows($result);
  Mcm_wed_table($result,$num_rows);
}

endPage();

